import React, {Component} from 'react';

class App extends Component {

    state = {
        list: ['1111', '2222', '3333'],

        elseList:[
            {
                id:1,
                name:'梁'
            },{
                id:2,
                name:'绍'
            },{
                id:3,
                name:'亨'
            },
        ],
    }

    render() {
        return (
            <div>
                <ul>
                    {
                        this.state.list.map(item =>
                                <li key={item}>{item}</li>
                        )}
                </ul>

                <br/>
                <ul>
                    {
                        this.state.elseList.map((item,index) =>
                            <li key={item.id}>{index}{item.name}</li>
                        )}
                </ul>
            </div>
        );
    }
}

/*
*原生js
* map方法循环
* */
export default App;